Skip to main content
PATCH
/
obras
/
:id
Update Public Work
curl --request PATCH \
  --url https://api.example.com/obras/:id \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "ejercicioFiscalId": 123,
  "claveUnica": "<string>",
  "nombre": "<string>",
  "descripcion": "<string>",
  "dependenciaId": 123,
  "monto": 123,
  "municipioId": 123,
  "tipoProyectoId": 123,
  "estatusObraId": 123,
  "ubicaciones": [
    {
      "id": 123,
      "municipioId": 123,
      "direccion": "<string>",
      "localidadReferencia": "<string>",
      "referenciaLugar": "<string>",
      "tipoGeometria": "<string>",
      "geometriaJson": {},
      "orden": 123
    }
  ]
}
'
{
  "id": 123,
  "numeroObra": 123,
  "claveUnica": "<string>",
  "nombre": "<string>",
  "descripcion": "<string>",
  "monto": 123,
  "ejercicioFiscalId": 123,
  "dependenciaId": 123,
  "municipioId": 123,
  "tipoProyectoId": 123,
  "estatusObraId": 123,
  "ubicaciones": [
    {}
  ]
}

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LizandroCanul/back_sdo/llms.txt

Use this file to discover all available pages before exploring further.

Updates an existing public work (obra). All fields are optional - only provided fields will be updated.

Authentication & Authorization

This endpoint requires admin role. Regular users cannot update obras.

Headers

Authorization
string
required
Bearer token for authentication with admin role
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type
string
required
Must be application/json

Path Parameters

id
number
required
The unique identifier of the obra to update

Request Body

All fields are optional. Only include the fields you want to update.
ejercicioFiscalId
number
Fiscal year ID for this obra
claveUnica
string
Unique key for the obra (max 50 characters). Must be unique across all obras.
nombre
string
Name of the public work (max 255 characters)
descripcion
string
Detailed description of the obra
dependenciaId
number
Department/dependency ID responsible for this obra
monto
number
Budget amount (must be positive, max 2 decimal places)
municipioId
number
Municipality ID where the obra is located
tipoProyectoId
number
Project type ID
estatusObraId
number
Work status ID (e.g., planned, in progress, completed)
ubicaciones
array
Array of location objects. This will replace existing locations.
id
number
Location ID (include for existing locations to update, omit for new locations)
municipioId
number
required
Municipality ID for this specific location
direccion
string
required
Street address
localidadReferencia
string
Locality reference
referenciaLugar
string
Place reference
tipoGeometria
string
Geometry type: PUNTO, RUTA, or POLIGONO
geometriaJson
object
GeoJSON geometry data
orden
number
Display order
When updating ubicaciones, any existing locations not included in the array will be deleted. Include the id field to update existing locations, or omit it to create new ones.
The numeroObra field is auto-generated and cannot be modified.

Response

Returns the updated obra object with all related entities populated.
id
number
Unique identifier for the obra
numeroObra
number
Sequential number within the fiscal year (unchanged)
claveUnica
string
Unique key for the obra
nombre
string
Name of the public work
descripcion
string
Detailed description
monto
number
Budget amount
ejercicioFiscalId
number
Fiscal year ID
dependenciaId
number
Department ID
municipioId
number
Municipality ID
tipoProyectoId
number
Project type ID
estatusObraId
number
Work status ID
ubicaciones
array
Array of location objects

Example Request

curl -X PATCH "https://api.yucatan.gob.mx/obras/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Construcción de Escuela Primaria (Actualizado)",
    "monto": 2800000.00,
    "estatusObraId": 2,
    "descripcion": "Construcción de escuela primaria con 6 aulas, áreas verdes y cancha deportiva"
  }'

Example Response

{
  "id": 1,
  "numeroObra": 1,
  "claveUnica": "OBRA-2024-001",
  "nombre": "Construcción de Escuela Primaria (Actualizado)",
  "descripcion": "Construcción de escuela primaria con 6 aulas, áreas verdes y cancha deportiva",
  "monto": 2800000.00,
  "ejercicioFiscalId": 1,
  "dependenciaId": 1,
  "municipioId": 1,
  "tipoProyectoId": 1,
  "estatusObraId": 2,
  "ubicaciones": [
    {
      "id": 1,
      "municipioId": 1,
      "direccion": "Calle 60 x 59, Col. Centro",
      "localidadReferencia": "Centro",
      "referenciaLugar": "Cerca del parque principal",
      "tipoGeometria": "PUNTO",
      "geometriaJson": {
        "type": "Point",
        "coordinates": [-89.6247, 20.9674]
      },
      "orden": 0
    }
  ]
}

Example: Updating Locations

curl -X PATCH "https://api.yucatan.gob.mx/obras/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "ubicaciones": [
      {
        "id": 1,
        "municipioId": 1,
        "direccion": "Calle 60 x 61, Col. Centro",
        "localidadReferencia": "Centro",
        "tipoGeometria": "PUNTO",
        "geometriaJson": {
          "type": "Point",
          "coordinates": [-89.6248, 20.9675]
        },
        "orden": 0
      },
      {
        "municipioId": 1,
        "direccion": "Calle 62 x 63, Col. Centro",
        "tipoGeometria": "PUNTO",
        "geometriaJson": {
          "type": "Point",
          "coordinates": [-89.6250, 20.9676]
        },
        "orden": 1
      }
    ]
  }'

Error Responses

401 Unauthorized

{
  "statusCode": 401,
  "message": "Unauthorized"
}
Returned when the JWT token is missing, invalid, or expired.

403 Forbidden

{
  "statusCode": 403,
  "message": "Forbidden resource",
  "error": "Forbidden"
}
Returned when the authenticated user does not have admin role.

404 Not Found

{
  "statusCode": 404,
  "message": "Obra 999 no encontrada.",
  "error": "Not Found"
}
Returned when the obra with the specified ID does not exist.

400 Bad Request

{
  "statusCode": 400,
  "message": [
    "monto must be a positive number"
  ],
  "error": "Bad Request"
}
Returned when request body validation fails.